﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="edintroduction.ascx.cs" Inherits="admin_edintroduction" %>
<%@ Register assembly="FredCK.FCKeditorV2" namespace="FredCK.FCKeditorV2" tagprefix="fckeditorv2" %>
<style type="text/css">

    .style1
    {
        width: 65px;
    }
    .style2
    {
        width: 587px;
    }
</style>
<table width="100%">
    <tr>
        <td class="style1">Ngôn ngữ: </td>
        <td class="style2">
            <asp:DropDownList ID="ddlLang" runat="server" AutoPostBack="True" 
                DataSourceID="SqlDataSource2" DataTextField="lang" DataValueField="id" 
                Height="32px" Width="127px" ValidationGroup="insert" Enabled="False">
            </asp:DropDownList>
            <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                ConnectionString="<%$ ConnectionStrings:canhbuomxanhconnectionstring %>" 
                SelectCommand="SELECT [id], [lang] FROM [Languages] ORDER BY [id] DESC">
            </asp:SqlDataSource>
        </td>
        <td>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                ControlToValidate="ddlLang" ErrorMessage="*" ValidationGroup="insert">Chưa Chọn Ngôn ngữ</asp:RequiredFieldValidator>
        </td>
    </tr>
    <tr>
        <td class="style1">Menu: </td>
        <td class="style2">
            <asp:TextBox ID="menu" runat="server" Width="217px" ValidationGroup="insert"></asp:TextBox></td>
        <td>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                ControlToValidate="menu" ErrorMessage="*" ValidationGroup="insert">Chưa Nhập Menu</asp:RequiredFieldValidator>
        </td>
    </tr>
    <tr>
        <td class="style1">Tiêu đề: </td>
        <td class="style2">
            <asp:TextBox ID="title" runat="server" Width="357px" MaxLength="5000" Rows="5" 
                TextMode="MultiLine" ValidationGroup="insert"></asp:TextBox></td>
        <td>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                ControlToValidate="title" ErrorMessage="*" ValidationGroup="insert">Chưa Nhập Tiêu Đề</asp:RequiredFieldValidator>
        </td>
    </tr>
    <tr>
        <td class="style1">Nội dung: </td>
        <td class="style2">
            <fckeditorv2:fckeditor ID="fckContent" runat="server" BasePath="~/fckeditor/" 
                Height="400px">
            </fckeditorv2:fckeditor>
        </td>
        <td>
        <asp:HiddenField ID="hdfContent" runat="server" />
        <asp:HiddenField ID="hdfID" runat="server" />
        </td>
    </tr>
    <tr>
        <td>
            &nbsp;</td>
        <td><center>
            <asp:Button runat="server" ID="addbt" Text="Thêm" 
                onclick="addbt_Click" ValidationGroup="insert"/></center></td>
    </tr>
</table>
<asp:SqlDataSource ID="SqlDataSource3" runat="server" 
    ConnectionString="<%$ ConnectionStrings:canhbuomxanhconnectionstring %>" 
    UpdateCommand="UPDATE [Introduction] SET [menu] = @menu, [title] = @title, [content] = @content WHERE [id] = @id AND [lang] = @lang">
    <UpdateParameters>
        <asp:ControlParameter ControlID="menu" Name="menu" PropertyName="Text" 
            Type="String" />
        <asp:ControlParameter ControlID="title" Name="title" PropertyName="Text" 
            Type="String" />
        <asp:ControlParameter ControlID="hdfContent" Name="content" 
            PropertyName="Value" Type="String" />
        <asp:ControlParameter ControlID="hdfID" Name="id" PropertyName="Value" 
            Type="Int64" />
        <asp:ControlParameter ControlID="ddlLang" Name="lang" 
            PropertyName="SelectedValue" Type="String" />
    </UpdateParameters>
   
</asp:SqlDataSource>
